
<div class="panel panel-default" id="catalogEditModal">
	<div class="panel-body">
		<form action="/catalog/save" method="post" id="catalogEditForm">
			<input type="hidden" name="id" value="${catalog.id}"/>
			<div class="modal-body">
				<div class="form-group">
					<label for="exampleInputEmail1">分类编号</label> <input
						class="form-control" name="code" value="${catalog.code}"/>
				</div>
				<div class="form-group">
					<label for="exampleInputEmail1">分类名</label> <input
						class="form-control" name="name" value="${catalog.name}"/>
				</div>
				<#if catalog.isParent==0>
				<div class="panel panel-default" style="margin-top: 20px;width: 500px">
                    <div class="panel-heading">
                        <a onclick="addProperty(${catalog.id})">添加分类属性</a>
                    </div>
					<table class="table table-striped">
						<thead>
						<tr>
							<th>属性名称</th>
							<th>属性类型</th>
							<th>属性值</th>
							<th>操作</th>
						</tr>
						</thead>
						<tbody>
						<#list catalog.properties as item >
						<tr>
							<td>${item.name}</td>
							<td>
								<select class="form-control" id="type" style="width: 120px">
									<option value="0" ${(item.type == 0)?string('selected="selected"','')}>文本</option>
									<option value="2" ${(item.type == 2)?string('selected="selected"','')}>下拉列表</option>
								</select>
							</td>
							<td>
								<select class="form-control">
									<#list item.values as value>
										<option>${value.value}</option>
									</#list>
								</select>
							</td>
						 	<td>
								<a class="btn btn-primary btn-sm" onclick="edit(${item.id},'${item.name}',${item.type})" >编辑</a><a class="btn btn-primary btn-sm" onclick="deleteProperty(${item.id})">删除</a><#if item.type==2><a class="btn btn-primary btn-sm" onclick="showProperty(${item.id})">属性值</a></#if>
								</td>
						</tr>
						</#list>
						</tbody>
					</table>
				</div>
				</#if>
				<div class="modal-footer">
					<button type="button" class="btn btn-default"
						data-dismiss="modal"  onclick="deleteCatalog(${catalog.id})">删除</button>
					<button type="button" class="btn btn-primary" id="eidtButton" onclick="eidtCatalog()">保存</button>
				</div>
			</div>
		</form>
	</div>
</div>


